export const showModal = ({ content }) => {
    return new Promise((res, rej) => {
        wx.showModal({
            title: '提示',
            content: content,
            showCancel: true,
            cancelText: '取消',
            cancelColor: '#000000',
            confirmText: '确定',
            confirmColor: '#3CC51F',
            success: (result) => {
                res(result);
            },
            fail: (err) => {
                rej(err);
            }
        });
    })
}

export const showToast = ({ title }) => {
    return new Promise((res, rej) => {
        wx.showModal({
            title: title,
            icon: "none",
            success: (result) => {
                res(result);
            },
            fail: (err) => {
                rej(err);
            }
        });
    })
}
export const login = () => {
    return new Promise((res, rej) => {
        wx.login({
            timeout: 10000,
            success: (result) => {
                res(result)
            },
            fail: (err) => { rej(err) }
        });
    })
}
export const requestPayment = (pay) => {
    return new Promise((res, rej) => {
        wx.requestPayment({
            ...pay,
            success: (result) => {
                res(result)
            },
            fail: (err) => {
                console.log(err);
            }
        });

    })
}